/*
 * Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef OHOS_SHARING_WFD_JS_RESULT_H
#define OHOS_SHARING_WFD_JS_RESULT_H

#include "napi/native_api.h"
#include "napi/native_node_api.h"
#include "wfd.h"
#include "wfd_def.h"

namespace OHOS {
namespace Sharing {

class WfdJsResult {
public:
    WfdJsResult(int32_t ret) : ret_(ret) {}
    virtual ~WfdJsResult() = default;

    virtual napi_status GetJsResult(napi_env env, napi_value &result);

protected:
    int32_t ret_;
};

class WfdErrorJsResult : public WfdJsResult {
public:
    WfdErrorJsResult(int32_t code, std::string msg, std::string deviceId)
        : WfdJsResult(0), code_(code), msg_(std::move(msg)), deviceId_(std::move(deviceId)) {}
    ~WfdErrorJsResult() = default;

    napi_status GetJsResult(napi_env env, napi_value &result) override;

private:
    int32_t code_;
    std::string msg_;
    std::string deviceId_;
};

// class WfdSourceConnectionJsResult : public WfdJsResult {
// public:
//     WfdSourceConnectionJsResult(ConnectionInfo info) : WfdJsResult(0), info_(info) {}
//     ~WfdSourceConnectionJsResult() = default;

//     napi_status GetJsResult(napi_env env, napi_value &result) override;

// private:
//     ConnectionInfo info_;
// };

// class WfdSourceAccelerationJsResult : public WfdJsResult {
// public:
//     WfdSourceAccelerationJsResult(std::string surfaceId) : WfdJsResult(0), surfaceId_(surfaceId) {}
//     ~WfdSourceAccelerationJsResult() = default;

//     napi_status GetJsResult(napi_env env, napi_value &result) override;

// private:
//     std::string surfaceId_;
// };

class WfdSourceDeviceFoundJsResult : public WfdJsResult {
public:
    WfdSourceDeviceFoundJsResult(std::vector<WfdCastDeviceInfo> info) : WfdJsResult(0), info_(info) {}
    ~WfdSourceDeviceFoundJsResult() = default;

    napi_status GetJsResult(napi_env env, napi_value &result) override;

private:
    std::vector<WfdCastDeviceInfo> info_;
};

class WfdSinkeDeviceRequestJsResult : public WfdJsResult {
public:
    WfdSinkeDeviceRequestJsResult(std::vector<WfdCastDeviceRequestInfo> info) : WfdJsResult(0), info_(info) {}
    ~WfdSinkeDeviceRequestJsResult() = default;

    napi_status GetJsResult(napi_env env, napi_value &result) override;

private:
    std::vector<WfdCastDeviceRequestInfo> info_;
};

} // namespace Sharing
} // namespace OHOS
#endif